package com.project.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import com.project.common.Constants;

@Configuration
public class InitEnvironmentAware implements EnvironmentAware {
	
	private static final Logger logger = LoggerFactory.getLogger(InitEnvironmentAware.class);

	@Override
	public void setEnvironment(Environment env) {
		logger.info("---------------初始化系统常量-------------------");
		Constants.WX_APPID = env.getProperty("wx_appid");
		Constants.WX_APPSECRET = env.getProperty("wx_appsecrect");
		Constants.SMS_APPID = env.getProperty("sms_appid");
		Constants.SMS_APPSECRET = env.getProperty("sms_appsecrect");
		Constants.OBJECT_STORAGE_URL_DOWNLOAD_IMAGE = env.getProperty("objectstorage.url.download.image");
		Constants.QINQU_GATEWAY_SEND_SMS_PATH = env.getProperty("qinqu_gateway_send_sms_path");
		Constants.WEB_CONTEXT_PATH = env.getProperty("web_context_path");
	}

}
